!===============================================================
!
! FUNZIONE DI GRIEWANK (n=2,5,10,20,....)
!
!===============================================================
!			VARIABLE BOUNDS
!===============================================================
!       -1.D+1               1.D+1         Limits of variable i

SUBROUTINE GRIEWANK(X,N,F)

      IMPLICIT NONE

      INTEGER          :: N
      DOUBLE PRECISION :: X(N), F

      INTEGER          :: I


      F = 1.D0

      DO I=1,N
         F = F*DCOS(X(I)/DSQRT(DBLE(I)))
      END DO

      F = -F+1.D0

      DO I=1,N
         F = F + X(I)*X(I)/200.D0
      END DO

      RETURN

END
